package com.travel.photos.ui.find.search;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import com.travel.R;
import com.travel.photos.bean.FindSearchTravelListBean;

import java.util.List;

import butterknife.Bind;
import butterknife.ButterKnife;
import tools.AdapterUtils;

/**
 * Created by meidou on 2016/10/22.
 */
public class SearchTravelAdapter extends AdapterUtils<FindSearchTravelListBean> {
    public SearchTravelAdapter(Context mcontext, List<FindSearchTravelListBean> totalList) {
        super(mcontext, totalList);
    }

    @Override
    public View getMyView(int position, View convertView, ViewGroup parent) {
        ViewHolder viewHolder;
        if (convertView == null) {
            convertView = mInflater.inflate(R.layout.photo_find_search_travel, parent, false);
            viewHolder = new ViewHolder(convertView);
            convertView.setTag(viewHolder);
        } else {
            viewHolder = (ViewHolder) convertView.getTag();
        }
        viewHolder.mPhotoFindSearchTravelText.setText(totalList.get(position).getTitle());
        viewHolder.mPhotoFindSearchTravelText1.setText("");
        viewHolder.mPhotoFindSearchTravelText2.setText(totalList.get(position).getPicCount());
        return convertView;
    }


    static class ViewHolder {
        @Bind(R.id.photo_find_search_travel_text)
        TextView mPhotoFindSearchTravelText;
        @Bind(R.id.photo_find_search_travel_text1)
        TextView mPhotoFindSearchTravelText1;
        @Bind(R.id.photo_find_search_travel_image1)
        ImageView mPhotoFindSearchTravelImage1;
        @Bind(R.id.photo_find_search_travel_text2)
        TextView mPhotoFindSearchTravelText2;

        ViewHolder(View view) {
            ButterKnife.bind(this, view);
        }
    }
}
